﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WSNs
{
    public partial class CtlNodeInfo : UserControl
    {
        public Action<int> DeleteNodeEvent;
        public CtlNodeInfo()
        {
            InitializeComponent();
        }

        public void RemoveAllItems()
        {
            clb_nodesshow.Items.Clear();
        }
        private void ToolStripMenuItem_Delete_Click(object sender, EventArgs e)
        {
            try
            {
                string[] s = clb_nodesshow.SelectedItem.ToString().Split(':');
                int nodeId = int.Parse(s[s.Count() - 1].Trim());
                DeleteNodeEvent(nodeId);
                clb_nodesshow.Items.Remove(clb_nodesshow.SelectedItem);
            }
            catch
            {
            }
        }
    }
}
